package com.maychat.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.stream.Stream;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserInfo implements Serializable {

    @Serial
    private static final long serialVersionUID = 6104727717684624653L;

    private String userId;
    private String email;
    private String nickName;
    private String phone;
    private Integer sex; // Assuming tinyint is mapped to Integer for simplicity
    private String password;
    private String personalSignature;
    private Integer status; // Assuming tinyint is mapped to Integer for simplicity
    private LocalDateTime createTime;
    private LocalDateTime lastLoginTime;
    private Long lastOfflineTime; // bigint unsigned is mapped to Long
    private String region;
    private String regionCode;
    private Integer joinType; // Assuming tinyint is mapped to Integer for simplicity

    public boolean allFieldsNullExceptId() {
        return Stream.of(email, nickName, phone, sex, password, personalSignature, status, createTime, lastLoginTime,
                lastOfflineTime, region, regionCode, joinType).allMatch(Objects::isNull);
    }
}